/**
 * 
 */
package com.effectivsocial.controller;

import jodd.util.StringUtil;
import lombok.extern.slf4j.Slf4j;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

/**
 * @author Dhrubo
 *
 */
@Controller
@Slf4j
public class GuestController {

	@RequestMapping(value="/guest/signin") 
	public String gotoSignIn(){
		return "signin";
	}
	
		
	@RequestMapping(value={"/","/signin"})
	public String index(){
		return "redirect:guest/signin.html";
	}
	
	
	
	@RequestMapping(value = "/login/{error}", method = RequestMethod.GET) 
	public final String displayLoginform(Model model,  @PathVariable final String error) {
		log.info("Error = {}", error);
		
		if(StringUtil.equals("expiredSession",error)) {
			model.addAttribute("info", error);
		}
		else{
			model.addAttribute("error", error);
		}
	    
		log.info("model = {}", model);
		
	    return "signin";
	}
	 
}
